#pragma once
#include <d3dx9.h>
#include <d3dx9math.h>
#include <d3dAppForm.h>
#include <d3dmodel.h>
#include <D3DAddOn.h>

#include "./Effect/funcs.h"
#include "./Effect/recycleArray.h"
#include "./Effect/EventList.h"
#include "./Effect/Particle.h"
#include "./Effect/EffectDataStruct.h"

#include "./Effect/ParticleVertex.h"
#include "./Effect/Particle.h"
#include "./Effect/ParticleEmitter.h"


#include "./effect/ASELoader.h"
#include "./effect/FXDynamicArray.h" 
#include "./effect/FXDataStruct.h"
#include "./effect/FXEvent.h"
#include "./effect/FXSeq.h"
#include "./effect/FXResource.h"

#define D3DFVF_SHADOWVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)

class Trails
{
	struct TRAILVERT
	{
		D3DXVECTOR3 pos;
		DWORD color;
	};

public:
	Trails(void);
	~Trails(void);

	LPDIRECT3DVERTEXBUFFER9 trails;
	void RenderTrails(SDrawElement *ele, int _step);
	void MakeTrails(SDrawElement *ele, int _step);
	void MakeBlur( SDrawElement *element );
	D3DXVECTOR3 vOldMin4, vOldMin3, vOldMin2, vOldMin1, vOldMin, vNextMin;
	D3DXVECTOR3 vOldMax4, vOldMax3, vOldMax2, vOldMax1, vOldMax, vNextMax;
	D3DXVECTOR3 vCatMulMin, vCatMulMax;	
	bool m_bIsFirstUpdateTrail;
	EFFECT_DATA     m_fxdata;
	CParticleVertexManager m_StripTrail; 
	CEventList m_EventList;	
	static Trails* GetTrails()
	{
		static Trails* instance = NULL;
		if( !instance )  
			instance = new Trails;
		return instance;
	}
};
